#-*- coding: utf-8 -*-
import json
import requests
import base64

url = "http://210.26.110.122:8080/hzsun-resm/sys/getCheckCode"
login_url = "http://210.26.110.122:8080/hzsun-resm/sys/login"
res = requests.get(url)
data = json.loads(res.text)
code = data['result']['code']
captcha = str(base64.b64decode(code), "utf-8")
checkKey = data['result']['key']

sysLoginModel = {"captcha" : captcha, "checkKey": checkKey, "username": "201756050126", "password": "jeecg"}
login_res = requests.post(login_url, json = sysLoginModel)
login_data = json.loads(login_res.text)
login_token = login_data['result']['token']
headers = {
    'X-Access-Token' : login_token
}
pay_load = {
    "type":"res"
}
query_url = "http://210.26.110.122:8080/hzsun-resm/resmanageinfo/queryList"
response = requests.post(query_url, headers = headers, json = pay_load)
query_data = response.text
que = query_data.replace('"','').replace('"','').strip('\n')
que = ''.join(que.split())
print(que)
s = "ewogICJlcnJDb2RlIiA6ICIwMDAwIiwKICAiY3VzdG9tTWVzcyIgOiBudWxsLAogICJyZXNwb25zZVJlc3VsdCIgOiBbIHsKICAgICJyZXNPclR5cGVOYW1lIiA6ICLlrp7orq3mpbwiLAogICAgInJlc1BpY1VybCIgOiAiaHR0cDovLzIxMC4yNi4xMTAuMTIyOjgwODAvaHpzdW4tcmVzbS9nZXRQaWMvMjAyMC8wNi8wOS9zeGwuanBnIiwKICAgICJyZXNUb3RhbENvdW50IiA6IDE4MCwKICAgICJyZXNP\nY2NweUNvdW50IiA6IDAsCiAgICAicmVzRnJlZUNvdW50IiA6IDE4MCwKICAgICJyZXNPclR5cGVJZCIgOiAiQTcxNkRGQTJEQkE2RTEwQ0UwNTMwMTAwMDA3RjBCMDYiCiAgfSwgewogICAgInJlc09y\nVHlwZU5hbWUiIDogIuS5kuS5k+eQg+mmhiIsCiAgICAicmVzUGljVXJsIiA6ICJodHRwOi8vMjEwLjI2LjExMC4xMjI6ODA4MC9oenN1bi1yZXNtL2dldFBpYy8yMDIwLzA5LzE2L3BpbmdwYW5ncWl1\nZ3Vhbi5wbmciLAogICAgInJlc1RvdGFsQ291bnQiIDogMjAsCiAgICAicmVzT2NjcHlDb3VudCIgOiAwLAogICAgInJlc0ZyZWVDb3VudCIgOiAyMCwKICAgICJyZXNPclR5cGVJZCIgOiAiQUY1MjE2REY1MTU4MUJEOEUwNTMwMTAwMDA3RkYzMDgiCiAgfSBdCn0="
x = str(base64.b64decode(que), "utf-8")
print(x)

